package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.InboxBean;
import com.project.bean.MailBean;
import com.project.mapper.IInboxMapper;
import com.project.service.IInboxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
@Service
@Transactional
public class InboxServiceImpl implements IInboxService {
    @Autowired
    private IInboxMapper mapper;
    @Override
    public PageInfo<InboxBean> findInboxByItem(Integer pageNO, String title, LocalDate startDate, LocalDate endDate, Integer inboxId) {
        PageHelper.startPage(pageNO,2);
        PageInfo<InboxBean> pg = PageInfo.of(mapper.findInboxByItem(title,startDate,endDate,inboxId));
        return pg;
    }

    @Override
    public MailBean findInboxById(Integer inboxId) {
        return mapper.findInboxById(inboxId);
    }

    @Override
    public void delInbox(Integer inboxId) {
        mapper.delInbox(inboxId);
    }
}
